<template>
  <el-select
    clearable
    filterable
    v-model="employeeId"
    placeholder="接待"
    @change="brandIdChange"
  >
    <el-option
      v-for="item in dataArry"
      :key="item.id"
      :value="item.id"
      :label="item.userName"
    />
  </el-select>
</template>
<script>
import { getStoreUser } from '@/api/after-sale/personnel/index'
import { mapGetters } from 'vuex'
export default {
  model: {
    props: 'value',
    event: 'input',
  },
  props: {
    value: {
      default: '',
    },
  },
  computed: {
    ...mapGetters(['stores', 'storesCalue']),
  },
  watch: {
    storesCalue: function (newValue, oldValue) {
        console.log('storesCalue改变',newValue)
      newValue && this._getStoreUser()
    },
  },
  data() {
    return {
      employeeId: '', //所有车辆品牌集合
      dataArry: [], //多选数组
    }
  },
  methods: {
    // formtValue(value){
    //   let _arry=[];
    //   if(value.length>0){
    //     for (let index = 0; index < value.length; index++) {
    //       const element = value[index];
    //       _arry.push(Number(element))
    //     }
    //   }
    //   return _arry;
    // },
    brandIdChange(value) {
      this.$emit('input', value)
    },
    async _getStoreUser() {
      await getStoreUser().then((res) => {
        let { success, data } = res
        if (success) this.dataArry = data
      })
    },
  },
  async created() {
    this._getStoreUser()
  },
  mounted() {
    // this.brandId = this.formtValue(this.value);
  },
}
</script>
